<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
</head>
<body>
<?php
include_once( '../config.php' );
require_once 'class/RenrenRestApiService.class.php';
$restApi = new RenrenRestApiService;
$token = '245624|6.4f9b886198703a4036bb431d5fd92f05.2592000.1389934800-515810977';
$params = array('uid'=>'313992699','access_token'=>$token);
$res = $restApi->rr_post_curl('/v2/status/list',$params);
dump($res);

/*$content = '测试一下。。。。。';
$params = array('status_id'=>'5003338868','owner_id'=>'364776761','content'=>$content,'access_token'=>$token);
$res1 = $restApi->rr_post_curl('status.addComment',$params);
dump($res1);*/

/*
$params = array('page_id'=>'601265866','access_token'=>$token);
$res1 = $restApi->rr_post_curl('pages.getFansList',$params);
dump($res1);*/

function dump($vars, $label = '', $return = false) {
    if (ini_get('html_errors')) {
        $content = "<pre>\n";
        if ($label != '') {
            $content .= "<strong>{$label} :</strong>\n";
        }
        $content .= htmlspecialchars(print_r($vars, true));
        $content .= "\n</pre>\n";
    } else {
        $content = $label . " :\n" . print_r($vars, true);
    }
    if ($return) { return $content; }
    echo $content;
    return null;
}
/*
method  true    string  status.gets
uid false   int 状态信息所属用户id，不指定则根据access_token或session_key判断为当前用户.
page    false   int 支持分页，指定页号，页号从1开始。缺省返回第一页数据。
count   false   int 支持分页，指定每页记录数，缺省为每页10条记录。最大不能超过1000。
*/
/*if ( isset($res['error_code']) > 0 ) {
	$msg = "<p>发送失败，错误：{$res['error_code']}:{$res['error_msg']}</p>";
	} else {
	$sql3="UPDATE `cai_content` SET `renren` ='1' WHERE  id='".$cai_id."';";
	if(mysql_query($sql3)){
	    $msg = "发送成功,更新成功";
	}else{
	    $msg = "发送成功,更新失败";
	} 
}
echo '人人'.$msg;*/
function getdomain1(){
    $host=$_SERVER['HTTP_HOST'];
    $host=strtolower($host);
    if(strpos($host,'/')!==false){
        $parse = @parse_url($host);
        $host = $parse['host'];
    }
    $topleveldomaindb=array('com','edu','gov','int','mil','net','org','biz','info','pro','name','museum','coop','aero','xxx','idv','mobi','cc','me');
    $str='';
    foreach($topleveldomaindb as $v){
        $str.=($str ? '|' : '').$v;
    }
    $matchstr="[^\.]+\.(?:(".$str.")|\w{2}|((".$str.")\.\w{2}))$";
    if(preg_match("/".$matchstr."/ies",$host,$matchs)){
        $domain=$matchs['0'];
    }else{
        $domain=$host;
    }
    return $domain;
}
?>
</body>
</html>